<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('虚拟用况接口列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>主接口名：</label>
                                <input type="text" name="masterInterfaceName"/>
                            </li>
                            <li>
                                <label>调用接口：</label>
                                <input type="text" name="slaveInterfaceName"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('interface:interface:edit')}]];
        var removeFlag = [[${@permission.hasPermi('interface:interface:remove')}]];
        var fbTypeDatas = [[${@dict.getType('fbType')}]];
        var prefix = ctx + "interfaceinfo/virtualUsage";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "虚拟用况接口",
                columns: [{
                    checkbox: true
                },
                    {
                        field: 'id',
                        title: 'ID',
                        visible: false
                    },
                    {
                        field: 'masterInterfaceName',
                        title: '主接口名称'
                    },
                    {
                        field: 'masterFbType',
                        title: '主接口前后类型',
                        formatter: function(value, row, index) {
                            return $.table.selectDictLabel(fbTypeDatas, value);
                        }
                    },
                    {
                        field: 'slaveInterfaceName',
                        title: '调用接口名称'
                    },
                    {
                        field: 'slaveFbType',
                        title: '调用接口前后类型',
                        formatter: function(value, row, index) {
                            return $.table.selectDictLabel(fbTypeDatas, value);
                        }
                    },
                    {
                        field: 'description',
                        title: '接口描述'
                    },
                    {
                        field: 'sortNum',
                        title: '排序'
                    },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="editParam(\'' + row.id + '\')"><i class="fa fa-edit"></i>设置参数</a> ');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });

        function editParam(id) {
            table.set();
            $.modal.openTab("设置虚拟用况参数", prefix + "/setParam?id=" + id + "&interfaceType=3", $(window).width());
        }
    </script>
</body>
</html>